<template>
  <div class="slidev-layout section">
    <div class="wrapper">
      <img class="logo" src="../assets/logo.png">
      <div class="number-back"></div>
      <div class="content">
        <slot />
      </div>
      <div class="number">{{ num }}</div>
    </div>
  </div>
</template>

<script setup>
import { computed } from 'vue'

const num = computed(() => {
  const idx = $nav.value.slides
    .filter(r => r.meta.layout == 'section')
    .findIndex(r => r.no == $nav.value.currentSlideNo)
  return (idx + 101).toString().substr(1, 2)
})
</script>

<style lang="postcss">
.slidev-layout.section {
  background-image: url('../assets/section.png');
  background-size: cover;
  background-position: center;
  padding: 0;

  .wrapper {
    height: 100%;
    background-color: rgba(255, 255, 255, 0.5);
    padding-top: 140px;
  }

  .logo {
    position: absolute;
    top: 10px;
    right: 20px;
    width: 280px;
  }

  .number-back {
    margin-left: 60px;
    width: 240px;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 40px solid rgb(64, 64, 64);
  }

  .content {
    height: 180px;
    background: linear-gradient(to right, rgb(0, 38, 90), rgb(0, 59, 132), rgb(2, 72, 158));
    padding-left: 310px;
    padding-top: 20px;
    font-size: 27px;
    color: white;
  }

  .number {
    margin-left: 80px;
    margin-top: -220px;
    width: 200px;
    height: 220px;
    background-color: rgb(10, 163, 212);
    padding-top: 20px;
    text-align: center;
    font-size: 130px;
    font-weight: bold;
    font-family: sans-serif;
    color: white;
  }

  h1 {
    margin-bottom: 30px;
    line-height: 40px;
    font-size: 40px;
    font-weight: bold;
    color: rgb(253, 203, 52);
  }

  p {
    margin: 24px 0;
    line-height: 24px;
  }
}
</style>
